var express = require('express');
var router = express.Router();


/* GET home page. */
router.get('/', function(req, res, next) {
  res.render('pages/index', {
  	title: '图书首页',
  	books: [{
  		title: "上帝掷骰子吗？",
  		poster: 'http://img3x4.ddimg.cn/26/11/22453424-1_w_2.jpg',
      buyUrl: 'http://product.dangdang.com/22453424.html',
  		_id: 1
  	},{
  		title: "上帝掷骰子吗？",
  		poster: "http://img3x4.ddimg.cn/26/11/22453424-1_w_2.jpg",
      buyUrl: 'http://product.dangdang.com/22453424.html',
  		_id: 2
  	},{
      title: "上帝掷骰子吗？",
      poster: "http://img3x4.ddimg.cn/26/11/22453424-1_w_2.jpg",
      buyUrl: 'http://product.dangdang.com/22453424.html',
      _id: 3
    },{
      title: "上帝掷骰子吗？",
      poster: "http://img3x4.ddimg.cn/26/11/22453424-1_w_2.jpg",
      buyUrl: 'http://product.dangdang.com/22453424.html',
      _id: 4
    },{
      title: "上帝掷骰子吗？",
      poster: "http://img3x4.ddimg.cn/26/11/22453424-1_w_2.jpg",
      buyUrl: 'http://product.dangdang.com/22453424.html',
      _id: 5
    },{
      title: "上帝掷骰子吗？",
      poster: "http://img3x4.ddimg.cn/26/11/22453424-1_w_2.jpg",
      buyUrl: 'http://product.dangdang.com/22453424.html',
      _id: 6
    }]
  });
});

/* GET detail page. */
router.get('/detail/:id', function(req, res, next) {
  res.render('pages/detail', {
    title: '图书详情页',
    book_title: '上帝掷骰子吗？',
    book_poster: "http://img3x4.ddimg.cn/26/11/22453424-1_w_2.jpg",
    book_buyUrl: 'http://product.dangdang.com/22453424.html',
    book_id: 1,
    book_info: '《上帝掷骰子吗》是关于量子论的故事。量子论是一个极为奇妙的理论：从物理角度来说，它在科学家中间引起了最为激烈的争议和关注；从现实角度来说，它给我们的社会带来了无与伦比的变化和进步；从科学史角度来说，也几乎没有哪段历史比量子论的创立得到了更为彻底的研究。然而不可思议的是，它的基本观点和假说至今没有渗透到大众的意识中去，这无疑又给它增添了一道神秘的光环。',
    book_author: '曹天元(Capo)',
    book_pages: 368,
    book_year: 2006,
    book_price: 32
  });
});

/* GET admin page. */
router.get('/admin', function(req, res, next) {
  res.render('pages/admin', { title: 'Admin Page'});
});

/* GET list page. */
router.get('/admin/list', function(req, res, next) {
  res.render('pages/list', { title: 'List Page'});
});

module.exports = router;
